<!DOCTYPE html>
<html>
<head>
<title>{$paper.paper_name} {:C('SITE_NAME')}</title>
<tc_include file="Public:head" />
<link href="/themes/simplebootx/Public/assets/css/base.css"	rel="stylesheet">
<link href="/themes/simplebootx/Public/assets/css/practice.css"	rel="stylesheet">
<link href="/themes/simplebootx/Public/assets/css/exam.css"	rel="stylesheet">
<link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
<style type="text/css">
.exam-info-box {
	background-color: #fff;
	padding: 0;
}

.exam-info-box {
	background-color: #FFF;
	border: #e0e0e0 solid 1px;
	border-top: #f04800 solid 3px;
	box-shadow: 1px 2px 3px #ddd;
}

.exam-info-box dl {
	padding: 0;
	margin: 0;
}

.exam-info-box dt, .exam-info-box dd {
	line-height: 30px;
	padding-left: 20px;
}

.exam-info-box dt {
	padding-left: 32px;
	line-height: 50px;
	color: #000;
	font-size: 16px;
	font-weight: bold
}

}
.dopra-con {
	margin: 0;
	padding: 0;
}
</style>
</head>
<body class="boxed">
	<div class="body">
		<!-- 通用头部 -->
		<div id="top"><tc_include file="Public:front_nav" /></div>
		<div class="shade-bg">
			<img src="__TMPL__Public/front/img/sha.png" class="slidershadow" alt="">
		</div>
		<div class="container">
			<div class="row">
				<div class="pracontent clearfix">
					<div class="s-adress">
						<i></i><a href="{:U('paper/paper_list')}">在线考试</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;<a
							href="{:U('paper/paper_list',array('ques_term_id'=>$paper['paper_term']))}">{$question_terms[$paper['paper_term']]}</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;<a
							href="#">{$paper.paper_name}</a>
					</div>
					<div class="m-paperHead bor ">
						<gt name="conanswer" value="0">
						<div class="score">
							<div class="num">{$user_score}</div>
							<div class="ico"></div>
						</div>
						</gt>
						<!--试卷头信息-->
						<h2 class="h2" style="color:#E45C40">
							【{$question_terms[$paper['paper_term']]}】{$paper.paper_name}</h2>
						<div class="info" style="padding:10px;">
							<p>◇ 本卷共 {$ques_list|count} 题，作答时间为 {$paper.paper_duration}分钟，总分
								{$paper.paper_score} 分，{$paper.paper_pass_score} 分及格。</p>
							<p>◇ 试卷来源：{:C('SITE_NAME')}</p>
						</div>
					</div>
					<div class="ui-progress f-shadow clearfix" style="position:relative;z-index:10;">
						<div id="m__ruleInfo" class="ui-progress-sub" style="z-index: 1001;position: static;">
							<div class="navBox">
								<volist name="ques_type_lite_arr" id="paper_type"> <neq
									name="ques_type_arr[$paper_type]['ques_list']|sp_arr_count"
									value="0">
								<button class="btn" type="button" onclick="javascript:location.href='#qlist_{$paper_type}'">{$question_types[$paper_type]}({$ques_type_arr[$paper_type]['ques_list']|sp_arr_count})</button>
								</neq> </volist>
							</div>
						</div>
					</div>
					<div class="row dopra-con clearfix">
						<div class="col-sm-8 col-md-9 pra-left-con">
							<foreach name="ques_type_arr" item="vo" key="paper_type">
							<if condition="strlen($ques_type_arr[$paper_type]['ques_list'])">
							<div id="questionModule" class="">
								<div id="qlist_{$paper_type}" class="m__ruleTitle" data-ruleid="31241">
									<div class="m-secpart">
										{$ques_type_index_name[$ques_type_index++]}、{$question_types[$paper_type]}（共<span
											id="ques_sel_count">{$ques_type_arr[$paper_type]['ques_list']|sp_arr_count}</span>题，每题{$ques_type_arr[$paper_type]['score']}分。）
									</div>
								</div>
								<ul class="m__ruleQuest" data-loadstate="notget">

									<foreach name="ques_list" item="vo"> <if
										condition="in_array($vo['id'],explode(',',$ques_type_arr[$paper_type]['ques_list']))">
									<li id="ques_{$vo.id}" style="" data-orderid="{++$ques_index}">
										<div class="subject-con bor clearfix m-question "
											data-paperid="{$paper.id}" 
											data-paperid="{$vo.id}" data-score="{$vo.ques_score}">
											<div class="subject-con <gt name="conanswer" value="0">sub-conanswer</gt>">
												<div class="sub-content ">
													<i class="subjec-daan <php>if($show_answer){if($user_answer_result[$vo['id']]['is_right']){</php> subjec-right<php>}else{</php> subjec-wrong<php>}}</php>"></i>
													<!-- <i class="subjec-daan" style="display: none;"></i> -->

													<div class="sub-dotitle">
														<em>{$ques_index}</em> <i>[{$question_types[$paper_type]}]</i>
														{$vo.ques_content|sp_remove_tag_p}<br>
													</div>
													<if condition="$paper_type!=3 and $paper_type!=5">
													<dl	class="sub-answer {$paper_type==1?'sub-answer-list':($paper_type==4?'sub-answer-list':'sub-answer-double')} sub-picon-no clearfix ">
														<volist name=":unserialize($vo['options'])" id="ques">
														<dd class="m-question-option {$show_answer&&strpos($user_answer_result[$vo['id']]['right_answer'],strval($i))>-1?" right-this":""}{$show_answer&&strpos(strval($user_answer_result[$vo['id']]['user_answer']),strval($i))>-1?" cho-this":""}" data-value="{$i}" data-quesid="{$vo.id}">
															<i></i>
															<?php echo ($paper_type<=2?$question_opts[$i].'. ':''); ?>
															{$ques}
														</dd>
														</volist>
													</dl>
													</if>

													<if condition="$show_answer">
													<else/>
													<div class="refer-answer refer-sc">
														<ul>
															<li class="nobro"><a href="javascript:;"
																class="btn__scbt scbt " data-quesid="{$vo.id}"><i></i>收藏本题</a></li>
														</ul>
													</div>
													</if>
												</div>
											</div>
											<if condition="$show_answer">
											<div class="m__answerLine refer-answer clearfix" style="display: block;">
												<div class="reck">
													参考答案：<em class="right">{:sp_get_type_option($vo['ques_type'],$vo['answer'])}</em> 您的答案：<em class="<if condition="$user_answer_result[$vo['id']]['is_right']">right<else/>wrong</if>">{:sp_get_type_option($vo['ques_type'],$user_answer_result[$vo['id']]['user_answer'])}</em>
												</div>
												<ul>
													<li class="nobro"><a href="javascript:void(0)"
														class="btn__scbt scbt " data-quesid="{$vo.id}"> <i></i>收藏本题
													</a></li>

													<!-- <li><a href="javascript:;" class="btn__jc jc"><i></i>纠错</a></li>

													<li><a href="javascript:;" class="btn__sqjx sqjx"><i></i>收起解析</a>
														<a href="javascript:;" class="btn__zkjx zkjx"
														style="display: none;"><i></i>展开解析</a></li> -->
												</ul>
											</div>
											<div class="solution">
												<ul>
													<li><span class="s-stnd"><i></i>试题难度：</span>
														<div class="so-star">
															<b style="width: {$vo['ques_level']*20}%"></b>
														</div></li>
													<li><span class="s-jx"><i></i>参考解析：</span>
														<div class="so-timu">
															<div class="wenzi">
																{$vo['ques_guide']*20}<br>					
															</div>					
														</div>
													</li>
												</ul>
											</div>
											</if>
										</div>
									</li>
									</if> </foreach>
								</ul>
							</div>
							</if> </foreach>
							<!-- 题目切换栏 -->
							<div id="pageBar"></div>
						</div>
						<!--右侧设置-->
						<div class="pra-right-con col-sm-4 col-md-3">
							<div id="m__rightPart" class="pra-right-con-sub"
								style="z-index: 99;">
								<div id="m__rightBtnLine" class="pra-r-set bor clearfix">
									<ul>
										<li><a href="javascript:;" class="btn__backList fhlb">
											<i></i>
											<p>返回</p>
										</a></li>
										<li><a href="javascript:showcalcu();" class="btn__jsq jsq"> <i></i>
											<p>计算器</p>
										</a></li>									
									</ul>
								</div>
								<div class="time-card f-mt20 bor">
									<eq name="conanswer" value="0">
									<div class="y-time">
										<span class="f-fl"><i></i>余时<em id="e__timer">00:00:00</em></span>
										<span class="btn__pause stop f-fr"><a href="javascript:;"><i></i>暂停</a></span>
									</div>
									</eq>
									<!--答题卡区域-->
									<div class="rightArea-answer clear">
										<div id="answerCard">
											<div class="hd clearfix">
												<a href="javaScript:;" class="answerCardLong">
												</a> <span class="title f-fl">答题卡
												<span class="e__doneCount card-count" style="font-size: 12px; color: #F06000; margin-left: 10px"><span id="do_count">0</span>/{$ques_list|count}</span>
												</span>
											</div>
											<div class="bd clear" style="min-height: 70px;max-height: 68px;">
												<form id="form_paper">
												<input type="hidden" name="paper_id" value="{$paper.id}" />
												<foreach name="ques_type_arr" item="vo" key="paper_type">
												<if condition="strlen($ques_type_arr[$paper_type]['ques_list'])">
												<dl class="panel-item">
													<dt>
														{$question_types[$paper_type]}<em>(每题{$ques_type_arr[$paper_type]['score']}分,共{$ques_type_arr[$paper_type]['ques_list']|sp_arr_count}题)</em>
													</dt>
													<dd class="panel-order">
														<foreach name="ques_list" item="vo"> 
														<if	condition="in_array($vo['id'],explode(',',$ques_type_arr[$paper_type]['ques_list']))">
														<a href="javascript:;" class="page-card-item checked" data-quesid="{$vo['id']}" data-index="{$key+1}">{$key+1}</a> 
														<input type="hidden" name="answer_list[{$vo['id']}][answer]" id="answer_{$vo['id']}" value="" />
														</if>
														</foreach>
													</dd>
												</dl>
												</if> </foreach>
												</form>
											</div>
										</div>
										<div class="cad-color clear">
											<div class="panel-order-notice panel-notice-t">
												<em>已做</em><i class="a doit"></i> <em>未做</em><i
													class="a normal"></i>
											</div>
										</div>
										<div class="ft">
											<if condition="$show_answer">
											<div class="btnn"><a href="javascript:;" class="btn__backList">返回列表</a></div>
											<else/>
											<div class="btnn btn-one">
												<a href="javascript:;" class="btn__nextGoon">保存进度，下次继续</a>
											</div>
											<div class="btnn">
												<a href="javascript:;" class="btn__submit">交卷</a>
											</div>
											</if>
										</div>
									</div>
									<!--答题卡区域 end-->
								</div>
							</div>
						</div>
						<!--右侧设置 end-->
					</div>
				</div>	
			</div>	
		</div>
		<tc_include file="Public:footer" />
	</div>
	<!-- JavaScript -->
	<tc_include file="Public:scripts" />
	<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/scrollFix.js"></script>

	<script type="text/javascript">

	$(".ui-progress-sub").css({width:$('.ui-progress-sub').width()});
	$(".pra-right-con-sub").css({width:$('.pra-right-con-sub').width()});
	$(".ui-progress-sub").scrollFix();
	$(".pra-right-con-sub").scrollFix(72);
	function showcalcu(){
		layer.open({
		      type: 2,
		      title: '计算器',
		      shadeClose: true,
		      shade: false,
		      maxmin: true, //开启最大化最小化按钮
		      area: ['692px', '426px'],
		      content: "{:U('paper/calcu')}",
		      success:function(layero, index){
		      }
		});
	}
	window.onload = function(){
		var HH = 0;
		var mm = 0;
		var ss = 0;
		var str = '';
		var timer = setInterval(function(){
			str = "";			
			if(++ss==60)
			{
				if(++mm==60)
				{
					HH++;
					mm=0;
				}
				ss=0;
			}			
			str+=HH<10?"0"+HH:HH;
			str+=":";
			str+=mm<10?"0"+mm:mm;
			str+=":";
			str+=ss<10?"0"+ss:ss;
			$("#e__timer").html(str);
		},1000);
	};
	<if condition="!$show_answer">
	//单项选择
	$('.sub-answer-list .m-question-option').click(function(){
		$(this).addClass('cho-this').siblings().removeClass('cho-this');
		var quesid=$(this).data('quesid');
		var answer_cho_arr=[];
		$('.m-question-option[data-quesid="'+quesid+'"]').each(function(){
			$val=$(this).data('value');
			if($(this).hasClass('cho-this')){
				answer_cho_arr.push($val);
			}
		});
		var answer_cho_string=answer_cho_arr.join(',');
		if(answer_cho_string.length>0){
			$('#answer_'+quesid).val(answer_cho_string);
			$('.page-card-item[data-quesid="'+quesid+'"]').removeClass('this').addClass('this');
		}
		$("#do_count").text($('.page-card-item.this').size());
		next_question($('#ques_'+quesid).data('orderid'));
	});
	//多项选择
	$('.sub-answer-double .m-question-option').click(function(){
		$(this).toggleClass('cho-this');
		var quesid=$(this).data('quesid');
		var answer_cho_arr=[];
		$('.m-question-option[data-quesid="'+quesid+'"]').each(function(){
			$val=$(this).data('value');
			if($(this).hasClass('cho-this')){
				answer_cho_arr.push($val);
			}
		});
		var answer_cho_string=answer_cho_arr.join(',');
		if(answer_cho_string.length>0){
			$('#answer_'+quesid).val(answer_cho_string);
			$('.page-card-item[data-quesid="'+quesid+'"]').removeClass('this').addClass('this');
		}
		else{
			$('#answer_'+quesid).val(answer_cho_string);
			$('.page-card-item[data-quesid="'+quesid+'"]').removeClass('this');
		}
		$("#do_count").text($('.page-card-item.this').size());
		//alert(answer_cho_string+'.'+quesid);
	});
	</if>
	//答题卡-快速定位
	$('.page-card-item').click(function(){
		var div='#ques_'+$(this).data('quesid');
		$('html, body').animate({  
            scrollTop: $(div).offset().top-$('.ui-progress-sub').height()
        }, 500);
	});
	//下一题	
	function next_question(current_index){
		var div='#ques_'+$("a[data-index='"+(current_index+1)+"']").data('quesid');
		$('html, body').animate({
            scrollTop: $(div).offset().top-$('.ui-progress-sub').height()
        }, 500);
	}
	//交卷	
	function submit_paper(isSubmit){
		
		$.ajax({
			cache : true,
			type : "POST",
			url : "{:U('paper/paper_submit')}"+"&issubmit="+(!isSubmit?0:1),
			data : $('#form_paper').serialize(),// 你的formid
			async : false,
			error : function(request) {
				console.log(request);
			},
			success : function(data) {
				Wind.use('artDialog', function() {
					art.dialog({
						id : 'succeed',
						icon : 'succeed',
						content : data.info,
						cancelVal : '关闭',
						cancel : true,
						ok : function() {	
							location.href=data.url;
							return true;
						}
					});
					return false;
				});
			}
		});
	
	}
	$('.btn__nextGoon').click(function(){		
		submit_paper(false);
	});
	$('.btn__submit').click(function(){		
		submit_paper(true);
	});

/* 	var showSetting=function(){
		$('.m__setting').toggle();		
	}
	
	$('.btn__setting').on("mouseover", function (e) {showSetting(); })
	.on("mouseout", function (e) {showSetting(); })
	.on("click", function (e) { showSetting(); }); */
	
	<if condition="$show_answer">
	$('.btn__backList').click(function(){		
		location.href="{:U('paper/paper_list')}";
	});
/* 	$('.m-question-option[data-quesid="'+quesid+'"]').each(function(){
		$val=$(this).data('value');
		if($(this).hasClass('cho-this')){
			answer_cho_arr.push($val);
		}
	}); */
	<else/>
	$('.btn__backList').click(function(){
		var finish_count=$('.page-card-item.this').size();
		var ques_count={$ques_list|count};
		var undo_count=ques_count-finish_count;
		if(undo_count>0){
			Wind.use("artDialog", function() {
				art.dialog({
					id : "succeed",
					icon : "succeed",
					fixed : true,
					lock : true,
					background : "#CCCCCC",
					opacity : 0,
					content : "你有“"+undo_count+"”道未完成的题目，请选择是否提交考试结果？",
					button : [ {
						name : '继续做题？',
						callback : function() {
							reloadPage(window);
							return true;
						},
						focus : true
					}, {
						name : '暂存试卷，返回列表',
						callback : function() {
							location = "{:U('Paper/paper_list')}";
							return true;
						}
					} ]
				});
			});
		}

		submit_paper(false);
	});
	</if>
	$('.btn__scbt').click(function(){
		var quesid=$(this).data('quesid');
		$.ajax({
			cache : true,
			type : "POST",
			url : "{:U('portal/questions/add_fav')}",
			data : {'id':quesid},// 你的formid
			async : false,
			error : function(request) {
				console.log(request);
			},
			success : function(data) {
				Wind.use('artDialog', function() {
					art.dialog({
						id : data.status==0?'error':'succeed',
						icon : data.status==0?'error':'succeed',
						content : data.info,
						cancelVal : '关闭',
						cancel : true,
						ok : function() {			
							return true;
						}
					});
					return false;
				});
			}
		});
	});
	</script>
</body>
</html>